/*
该文件专门用于暴露一个store对象 整个应用只有一个store对象 
*/
//引入 createStore 专门用于创建redux中最为核心的store对象
import {
    createStore,
    combineReducers,
    applyMiddleware
  } from "redux";
//引入为Count组件服务的reducer
import countReducer from "./reducers/countReducer"
import movieReducer from "./reducers/movieReducer"

//异步处理中间件
//当我们要进行异步action，action是一个函数，我们dispacth的函数就会提交到中间件
//中间件帮我们执行函数，一般函数中会有一个dispatch再次派发到store中
import thunk from 'redux-thunk';

//使用redux提供的combineReducers方法 合并多个reducer
const allReducer = combineReducers({
  movie: movieReducer,
  count: countReducer
})

const store =createStore(allReducer,applyMiddleware(thunk))

export default store 

//暴露store
// export default createStore(countReducer)
